package com.qianda.qdminiapp.controller.device;


import com.qianda.qdminiapp.controller.Result;
import com.qianda.qdminiapp.domain.dto.PageRequest;
import com.qianda.qdminiapp.service.QqdStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cw
 * @since 2019-08-14
 */
@RestController
@RequestMapping("/qqd-store")
public class QqdStoreController {

    @Autowired
    private QqdStoreService qqdStoreService;


    /**
     * 获取门店列表
     * @param storeName
     * @return
     */
    @GetMapping("/getStores")
    private Result findStore(String storeName,Double lat,Double lng, PageRequest pageRequest){
        return Result.success(qqdStoreService.findNearStore(storeName,lat,lng,pageRequest));
    }

    /**
     * 获取附近5公里内的门店
     * @param lat
     * @param lng
     * @return
     */
    @GetMapping("/getStoresByLatAndLnt")
    private Result getStoresByLatAndLnt(Double lat,Double lng){
        return Result.success(qqdStoreService.findNearStoreByLatAndLng(lat,lng));
    }
}

